package cn.net.yugu.doraemon.sharding.strategy;

import cn.net.yugu.doraemon.sharding.exception.ShardException;
import cn.net.yugu.doraemon.sharding.model.ShardContext;
import org.apache.commons.lang3.StringUtils;

/**
 *
 * 分表策略.
 * @author wanghongli
 * @date 2023/12/16 14:01
 * @description ITableShardStrategy
 **/
public interface ITableShardStrategy {
    String generateTableName(String tableNamePrefix, ShardContext shardContext);

    default void verifyTableNamePrefix(String tableNamePrefix) {
        if (StringUtils.isBlank(tableNamePrefix)) {
            throw new ShardException("tableNamePrefix is blank");
        }
    }
}
